package com.auto.reg.active;

import java.util.Timer;
import java.util.TimerTask;

import com.auto.reg.util.CmdUtil;
import com.auto.reg.util.RefreshDownloadUtil;

public class DownloadManager {
	
	public static void main(String[] args) {
		Timer timer = new Timer(false);
		WorkerTask task = new DownloadManager().new WorkerTask("single_download.exe");
		timer.scheduleAtFixedRate(task, 0, 5000);
	}

    class WorkerTask extends TimerTask {
		
		private String processName;
		
		public WorkerTask(String processName) {
			this.processName = processName;
		}

		@Override
		public void run() {
            if (CmdUtil.findProcess(processName) == false) {
            	RefreshDownloadUtil.refreshDownloadIni();
            	CmdUtil.executeCommand("auto_res/down/single_download.exe");
            }
		}
	}

}
